package com.dd.stack.redis.pojo.DO;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * @Author liuxianmeng
 * @CreateTime 2025/1/8 21:47
 * @Description Java通用DO类 用于演示在MyBatis-Plus中对各种数据类型的增删改查
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "dd_mp_data_object", autoResultMap = true)
@ApiModel("Java通用DO类 用于演示在MyBatis-Plus中对各种数据类型的增删改查")
public class DataObjectDO {
    @ApiModelProperty("数据库id")
    @TableId(type = IdType.AUTO)
    private Long id;
    @ApiModelProperty("整型包装类")
    @TableField(value = "int_value")
    private Integer intValue;
    @ApiModelProperty("长整型包装类")
    @TableField(value = "long_value")
    private Long longValue;
    @ApiModelProperty("双精度浮点型包装类")
    @TableField(value = "double_value")
    private Double doubleValue;
    @ApiModelProperty("字符串类型")
    @TableField(value = "string_value")
    private String stringValue;
    @ApiModelProperty("本地日期时间类型")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(value = "local_datetime_value")
    private LocalDateTime localDateTimeValue;
    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(value = "created_at")
    private LocalDateTime createdAt;
    @ApiModelProperty("本地日期时间类型")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(value = "updated_at")
    private LocalDateTime updatedAt;
    @ApiModelProperty("json字符串类型数据")
    @TableField(typeHandler = JacksonTypeHandler.class)
    private JsonValueDO jsonValue;
    @TableField(value = "type_enum_value")
    @ApiModelProperty("存储枚举常量名称（如：用户类型 [1]普通用户 [2]管理员）")
    private String typeEnumValue;
}